import sqlite3
from sqlite3 import OperationalError

conn = sqlite3.connect('eth_gas_price.sqlite3')
cur = conn.cursor()
try:
    sql = """CREATE TABLE gas_price (
                id integer primary key autoincrement,
                coin_name varchar(15) not null,
                low integer,
                avg integer,
                high integer,
                c_time integer
            );"""
    cur.execute(sql)
    print("create table success")
except OperationalError as o:
    print(str(o))
    pass
    if str(o) == "table gas_price already exists":
        pass
except Exception as e:
    print(e)
finally:
    cur.close()
    conn.close()
